/// <reference path="fKanban.js" />
/* fKanban.task */
fKanban.task = function () { }
fKanban.task.prototype = new fKanban();
fKanban.task.prototype.constructor = fKanban.task;
fKanban.task.prototype.supr = fKanban.prototype;

//add
fKanban.task.prototype.add = function (item, fn_successful) {
    $.ajax({
        type: "POST",
        url: website + "Online/AddSprintTask",
        dataType: "json",
        data: item,
        success: function (result) {
            if (fn_successful) fn_successful(result);
        },
        error: function (err) {
            Info(err);
        }
    });
};

//update
fKanban.task.prototype.update = function (item, fn_successful) {
    $.ajax({
        type: "POST",
        url: website + "Online/UpdateSprintTask",
        dataType: "json",
        data: item,
        success: function (result) {
            if (fn_successful) fn_successful(result);
        },
        error: function (err) {
            Info(err);
        }
    });
};

//remove
fKanban.task.prototype.remove = function (id, fn_successful) {
    $.ajax({
        type: "POST",
        url: website + "Online/RemoveSprintTask",
        dataType: "json",
        data: {id: id },
        success: function (result) {
            if (fn_successful) fn_successful(result);
        },
        error: function (err) {
            Info(err);
        }
    });
};

//loadDataBySprintGoalId
fKanban.task.prototype.loadDataBySprintGoalId = function (sprintGoalId, fn_successful, onerror) {
    $.ajax({
        type: "POST",
        async: true,
        url: website + "Online/LoadSprintTasksBySprintGoalId",
        dataType: "json",
        data: { sprintGoalId: sprintGoalId },
        success: function (result) {
            if (fn_successful) fn_successful(result);
        },
        error: function (err) {
            Info(err);
        }
    });
};

//loadDataBySprintTaskId
fKanban.task.prototype.loadDataBySprintTaskId = function (id, fn_successful, onerror) {
    $.ajax({
        type: "POST",
        async: true,
        url: website + "Online/LoadSprintTaskById",
        dataType: "json",
        data: { id: id },
        success: function (result) {
            if (fn_successful) fn_successful(result);
        },
        error: function (err) {
            Info(err);
        }
    });
};